// JavaScript Document
 var fileLocation ='js/echarts';
require.config({
   
    paths:{ 
         echarts: fileLocation,
            'echarts/chart/line': fileLocation,
            'echarts/chart/bar': fileLocation,
            'echarts/chart/pie': fileLocation
 
    }
});

// 作为入口
require(
    [
        'echarts',
        'echarts/chart/pie'
    ], 
	
	displayChart
    
);

function displayChart(ec) {
    	//饼图
		var pieChart = ec.init(document.getElementById('pie'));
		var pieChartOtion = getPieChartOption();	
        pieChart.setOption(pieChartOtion);
    }
	
	//获得Pie图的选项和数据
	function getPieChartOption(){
	  var pieChartOption = {
    	title : {
        text: '本月请假人员按部门统计',
        x:'center'
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c}人 ({d}%)"
    },
    legend: {
        orient : 'vertical',
        x : 'left',
        data:['政治处','户政科','宣传科','办公室','指挥中心']
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            magicType : {
                show: true, 
                type: ['pie', 'funnel'],
                option: {
                    funnel: {
                        x: '25%',
                        width: '50%',
                        funnelAlign: 'left',
                        max: 1548
                    }
                }
            },
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    series : [
        {
            name:'请假人数',
            type:'pie',
            radius : '55%',
            center: ['50%', '60%'],
            data:[
                {value:3, name:'政治处'},
                {value:10, name:'户政科'},
                {value:4, name:'宣传科'},
                {value:5, name:'办公室'},
                {value:8, name:'指挥中心'}
            ]
        }
    ]
};
                    
	
	
	return pieChartOption;
	}